<template>
	<!--选择险种代码-->
	<el-dialog title="选择险种代码" :visible.sync="dialogVisible" size="small" :close-on-click-modal="false" :close-on-press-escape="false" :before-close="off">
		  <el-form label-width="150px" >
		  <el-row :span="24">
		  	<el-form-item label="归属险种代码" label-width="150px" :span="24">
				<el-select v-model="ownerriskcode"  placeholder="险种代码" filterable size="small" style="width:80%">
					<el-option v-for="item in riskOptions" :key="item.riskcode" :label="item.riskcode +  '-' + item.riskcname" :value="item.riskcode"></el-option>
				</el-select>
			</el-form-item>
		  </el-row>
		</el-form>
		  <span slot="footer" class="dialog-footer">
			   <el-button @click="off">取 消</el-button>
			   <el-button type="success" @click="select">确 定</el-button>
		  </span>
	</el-dialog>
</template>

<script>

import RiskAPI from "../../../../js/production/risk/riskAPI";

  export default {
	data() {
		return {
			dialogVisible: true,
			ownerriskcode : '',
			currentRiskCode : '',
			classcode : '',
			riskOptions : [],
		}
	},
	mounted() {
		this.currentRiskCode = this.$parent.currentRiskCode;
		this.classcode = this.$parent.formData.kind.ownerriskcode;
		if(this.classcode.length > 2) {
			this.classcode = this.classcode.substring(0,2);
		}
		RiskAPI.queryRiskByClass(this);
	},
	methods: {
		select() {
			this.$parent.tempRiskCode = this.ownerriskcode;
			this.$parent.tempId = this.currentRiskCode;
			this.off();
		},
		off() {
			this.$parent.showOwnerRiskSelect = false;
		}
	}
  }
</script>